package com.njtech.pet.constant;

import com.njtech.pet.dao.ItemDao;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author lxj
 * Date 2020-03-13 10:27
 * Description 常量类的使用范例
 */
public class Example {
    public static void main(String[] args) {
        //获取某个类的常量的key或value
        Integer key = Constant.Item.STATE_EXPIRED.getKey();
        String value = Constant.Item.STATE_EXPIRED.getValue();
        Integer lower = Constant.Member.LEVEL0.getLower();
        Integer upper = Constant.Member.LEVEL0.getUpper();
        Double discount = Constant.Member.LEVEL0.getDiscount();
        Double creditPersent = Constant.Member.LEVEL0.getCreditPercent();
        Double signInPersent = Constant.Member.LEVEL0.getCreditPercent();

        System.out.println(key+"+"+value+"+"+lower+"+"+upper+"+"+discount+"+"+creditPersent+"+"+signInPersent);
        //Date类转String类
        Date date = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        String str = df.format(date).substring(0,4);
        Integer a = (Integer.parseInt(str)*365) + (Integer.parseInt(df.format(date).substring(5,7))*30) + (Integer.parseInt(df.format(date).substring(8,10)));
        System.out.println(a);



    }
}
